'use strict';

var fs = require('fs');


var w = 'abcdefghijklmnopqrstuvwxyz';
fs.writeFile('sample.txt', w, function (err) {
    if (err) {
        console.log(err);
    } else {
        console.log('ok.');
    }
});


var data = fs.readFileSync('sample.txt', 'utf-8');
console.log(data);


fs.readFile('sample.txt', 'utf-8', function (err, data) {
    if (err) {
        console.log(err);
    } else {
        console.log(data);
    }
});


fs.readFile('girl.jpg', function (err, data) {
    if (err) {
        console.log(err);
    } else {
       // console.log(data.toString('utf-8'));
        console.log(data.length + ' bytes');
    }
});